﻿<style>
    .xm-select-linkage .xm-select-linkage-group li {
        height:24px;
        line-height:24px
    }
    .xm-select-linkage .xm-select-linkage-group li span{
       line-height:24px
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">  
        当前选中<span style="color:red" id="goodnum"></span>个商品
        <br /><span style="color:green">注：选品提交成功后商品默认为下架状态，待资料完善后手动上架(下架状态商品将不会在商城中显示)<span style="color:red"></span></span>
        <div class='layui-form-item'>
            <label class="layui-form-label"></label>
            <div class='layui-input-inline'>
                <button class="layui-btn layuiadmin-btn-list" data-type="confirm">提交选品</button>
            </div>
        </div>
    </div>
    <div>
        <div id="res" style="color:green"></div>
    </div>
</div>
<script>
     
    var form, admin, $;

    layui.use(['form', 'admin', 'table'], function () {
        var $ = layui.$
        , admin = layui.admin
        , view = layui.view 
        , form = layui.form;
        var table = layui.table;
         
        $("#goodnum").text(checkids.length);

        var active = {
            confirm: function () { 
                if (checkids.length === 0) {
                    return layer.msg('请选择商品');
                }
                debugger;
                var ids = JSON.stringify(checkids);
                var index = layer.load(1); 
                admin.req({
                    url: layui.setter.APIUrl + '/shop/goods_baseMgr/GoodUpper' //实际使用请改成服务端真实接口
                  , data: { "ids": ids }
                      , type: "post"
                    , success: function (res) {
                        debugger;
                        layer.close(index); //执行关闭
                        if (res.ResultCode == 0) { 
                            $("#res").html(res.ResultInfo); 
                            checkids = [];
                            table.reload('LAY-app-content-list');
                        } else {
                            $("#res").html(res.ResultInfo);
                        }
                    }
                });
            },
        };

        $('.layui-btn.layuiadmin-btn-list').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
